import React, {useEffect} from 'react';
import {useRequest} from 'ahooks';
import {getUrlOneHours} from "@/services/holiday.ts";

/**
 * 产业监测3.0临时图片
 * @author Finn Yu
 * @since 2023/7/6 15:12
 */
const Cyjc3TempImg: React.FC<any> = ({src, className}: any) => {
    const {run, data} = useRequest(getUrlOneHours, {
        manual: true,
    });
    useEffect(() => {
        if (src && !src.startsWith('http')) {
            run({filePath: src,});
        }
    }, [src]);
    return (
        <>
            {(src?.startsWith('http') || data) ? <img className={className} src={data || src} alt=''/> : ''}
        </>
    );
};

export default Cyjc3TempImg;
